package demo1;

public class People implements Comparable<People>{
    public int age;
    public String name;

    @Override
    public String toString() {
        return "People{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }

    public People(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public int compareTo(People o) {
        return Integer.compare(this.age,o.age);
    }
}

